package top.revery.api.api.user;


import org.springframework.web.bind.annotation.*;
import top.revery.api.config.UserPageData;
import top.revery.api.entity.user.BaseUserInfo;
import top.revery.api.entity.vo.BaseUserInfoVo;


/**
 * @author denghao
 * @title 用户接口
 * @package
 * @date 2019/12/12 15:45
 */
@RequestMapping("/api_userInfo")
public interface IUserInfoApi {

    //保存用户
    @PostMapping("/save")
    BaseUserInfo save(@RequestBody BaseUserInfo userInfo);

    //根据查询用户
    @PostMapping("/findById")
    BaseUserInfoVo findById(@RequestParam("id") Long id) throws Exception;

   //分页查询所有
    @PostMapping("/getList")
    UserPageData getList(
            @RequestParam(value = "pageNum") int pageNum,
            @RequestParam(value = "pageSize")int pageSize);

    //发送消息，获取验证码
    @PostMapping("/sendsms")
    public String sendsms(@RequestParam("mobile") String mobile) throws Exception;

    //用户注册
    @PostMapping("/register")
    public BaseUserInfo register(@RequestParam("code") String code,
                                 @RequestParam("codeSign") String codeSign,
                                 @RequestParam("name") String name,
                                 @RequestParam("telephone") String telephone,
                                 @RequestParam("userType") int userType,
                                 @RequestParam("password") String password,
                                 @RequestParam(value = "email",defaultValue ="") String email)throws Exception;
    //用户登录
    @PostMapping("/login")
    public BaseUserInfo login(@RequestParam("name") String name,
                                 @RequestParam("password") String password)throws Exception;

    //忘记密码
    @PostMapping("/forget")
    public Boolean forget(@RequestParam("code") String code,
                          @RequestParam("codeSign") String codeSign,
                          @RequestParam("telephone") String telephone,
                          @RequestParam("password") String password)throws Exception;


}
